<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

    <script type="text/javascript">

        let skuProperties=[{
            id:1,
            specName:"年龄",
            options:["萝莉","御姐"]
        },{
            id:2,
            specName:"肤色",
            options:["土豪金","钛金灰"]
        }]

        //第一次迭代的结果:[{年龄:"萝莉"},{年龄:"御姐}]
        let result = skuProperties.reduce((previos,current,index)=>{
            let arr = [];
            previos.forEach(e1=>{
                current.options.forEach(e2=>{
                    let obj = Object.assign({},e1);
                    //添加属性
                    obj[current.specName] = e2;

                    if(index==skuProperties.length-1){
                        //最后一次累加
                        obj["price"] = 0;
                        obj["store"] = 0;
                    }

                    arr.push(obj);
                })
            })
            return arr;
        },[{}])

        console.log(result);




        //得到一个结果
       /*let result = [
            {"年龄":"萝莉","肤色":"土豪金","price":0,"store":0},
            {"年龄":"萝莉","肤色":"钛金灰","price":0,"store":0},
            {"年龄":"御姐","肤色":"土豪金","price":0,"store":0},
            {"年龄":"御姐","肤色":"钛金灰","price":0,"store":0}]
*/

    </script>

</body>
</html>